package cn.lavenir.fyai.rag.stream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @author dinghq
 * @description
 * @date 2025/7/8
 */
@RestController
public class ChatController {

    @Autowired
    Assistant assistant;

//    @GetMapping(value = "/chat", produces = "text/event-stream;charset=utf-8")
    @GetMapping(value = "/chat", produces = "text/stream;charset=utf-8")
    public Flux<String> model(@RequestParam(value = "message", defaultValue = "Hello") String message) {
        Flux<String> result = assistant.chat(1,message);
        return result;
    }
}
